#include "StdAfx.h"
#include "Tick.h"
#include "OS.h"
#include "util/Log.h"

Tick::Tick(void):tickStart(0), tickEnd(0)
{
	Start();
}

Tick::~Tick(void)
{
}
void Tick::Start(){
	tickStart = OS::GetTimeTick();
}
long Tick::End(const char* prefix){
	tickEnd = OS::GetTimeTick();
	long tick = tickEnd - tickStart;
	;
	if(prefix){
		Log<<"[Tick] "<<prefix<<":"<<tick<<endl;
	}else{
		Log<<"[Tick] "<<tick<<endl;
	}
	return tick;
}

Tick Tick::Go(){
	Tick t;
	t.Start();
	return t;
}